const API = require('../../pages/api/index')
const { typeJson } = require('../../utils/typejson')
let prolist = wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist'))


Page({

  /**
   * 页面的初始数据
   */
  data: {
    pulldown:"",
    pullup:2,
    addButton:true,
    prolist:wx.getStorageSync('prolist')==''?wx.getStorageSync('prolist'):JSON.parse(wx.getStorageSync('prolist')),
    listConfig: [
        {
          label: '检查人',
          prop: 'checkMan'
        },
        {
          label: '记录日期',
          prop: 'checkDate'
        }
      ],

      slide: {
        slideButton: {
          text: '编辑',
          extClass: 'test',
            src: '/page/weui/cell/icon_star.svg', // icon的路径
        },
        formConfig: [
          {
               
               prop:"checkManId",
               tag: 'userid',
               label: '检查人',
               hidden:"all"
          },
         
           {
             label: '计划名称',
             prop: 'planId',
             type: 'dropDownSearch',
             hidden: 'look',
             required:true,
             net: {
               url: '/app/deviceCheckPlan/getList',
               method: 'post',
               key: 'planName',
               data:{
                 mineId: true,
                 planType:2
               },
               value: 'id'
             }
           },
           {
             label: '检查人',
             prop: 'checkMan',
             hidden: 'edit',
           },
          
       
           {
             label: '检查人',
             prop: 'checkManId',
             type: 'multiDropDown',
             required:true,
             hidden: 'look',
             net: {
               url: '/app/memberinfo/getList',
               method: 'post',
               data:{
                 mineId: true,
                
               },
               key: 'memberId',
               value: 'nickName'
             }
           },
          
           {
             label: "检查日期",
             prop: "checkDate",
             required:true,
             type:'date'
           },
           {
             label: "泵房卫生",
             prop: "sanitation",
           },
            
           
             {
               label: '警示标志',
               prop: 'label',
               jsonType: typeJson.deviceStatus,
               required:true,
               type: 'dropDown'
             },
             {
               label: '运转情况',
               prop: 'situation',
               jsonType: typeJson.deviceStatus,
               required:true,
               type: 'dropDown'
             },
             {
               label: '供配电线路',
               prop: 'wiring',
               jsonType: typeJson.deviceStatus,
               required:true,
               type: 'dropDown'
             },
             {
               label: '闸阀关闭情况',
               prop: 'sluice',
               jsonType: typeJson.sluice,
               required:true,
               type: 'dropDown'
             },
             {
               label: '排水及涌水情况',
               prop: 'drain',
               jsonType: typeJson.deviceStatus,
               required:true,
               type: 'dropDown'
             },
             {
               label: '水仓溶剂及淤堵情况',
               prop: 'sump',
               jsonType: typeJson.sump,
               required:true,
               type: 'dropDown'
             },
             {
               label: '安全出口物资情况',
               prop: 'materials',
               jsonType: typeJson.deviceStatus,
               required:true,
               type: 'dropDown'
             },
          
             {
               label: "检查记录",
               prop: "checkRec",
               required:true,
               type:"textarea",
             },
   
             {
               label: '是否存在隐患',
               prop: 'isRisk',
               jsonType: typeJson.isRisk,
               required:true,
               type: 'dropDown'
             },
           
             {
               label: "来源",
               prop: "source", 
               jsonType:typeJson.source,
               type: "dropDown",
               
             },
             {
               label: "隐患部位",
               prop: "part",
               
             },
             {
               label: "隐患级别",
               prop: "level",
               type: "dropDown",
               jsonType: typeJson.level,
               
             },
             {
               label: "核查人",
               prop: "verifyManId",
               type: 'dropDownSearch',
               hidden: 'look',
               
               net: {
                 url: '/app/memberinfo/getList',
                 method: 'post',
                 key: 'nickName',
                 data:{
                   mineId: true,
                 },
                 value: 'memberId'
               }
             },
             {
               label: "发现时间",
               prop: "discoverDate",
               
               type:"date"
             },
             // {
             //   label: '照片',
             //   prop: 'photo',
              
             //   type: 'image'
             // },
          
           ],
      },
 
      formConfig: [
       {
            
            prop:"checkManId",
            tag: 'userid',
            label: '检查人',
            hidden:"all"
       },
      
        {
          label: '计划名称',
          prop: 'planId',
          type: 'dropDownSearch',
          hidden: 'look',
          required:true,
          net: {
            url: '/app/deviceCheckPlan/getList',
            method: 'post',
            key: 'planName',
            data:{
              mineId: true,
              planType:2
            },
            value: 'id'
          }
        },
        {
          label: '检查人',
          prop: 'checkMan',
          hidden: 'edit',
        },
       
    
        {
          label: '检查人',
          prop: 'checkManId',
          type: 'multiDropDown',
          required:true,
          hidden: 'look',
          net: {
            url: '/app/memberinfo/getList',
            method: 'post',
            data:{
              mineId: true,
             
            },
            key: 'memberId',
            value: 'nickName'
          }
        },
       
        {
          label: "检查日期",
          prop: "checkDate",
          required:true,
          type:'date'
        },
        {
          label: "泵房卫生",
          prop: "sanitation",
        },
         
        
          {
            label: '警示标志',
            prop: 'label',
            jsonType: typeJson.deviceStatus,
            required:true,
            type: 'dropDown'
          },
          {
            label: '运转情况',
            prop: 'situation',
            jsonType: typeJson.deviceStatus,
            required:true,
            type: 'dropDown'
          },
          {
            label: '供配电线路',
            prop: 'wiring',
            jsonType: typeJson.deviceStatus,
            required:true,
            type: 'dropDown'
          },
          {
            label: '闸阀关闭情况',
            prop: 'sluice',
            jsonType: typeJson.sluice,
            required:true,
            type: 'dropDown'
          },
          {
            label: '排水及涌水情况',
            prop: 'drain',
            jsonType: typeJson.deviceStatus,
            required:true,
            type: 'dropDown'
          },
          {
            label: '水仓溶剂及淤堵情况',
            prop: 'sump',
            jsonType: typeJson.sump,
            required:true,
            type: 'dropDown'
          },
          {
            label: '安全出口物资情况',
            prop: 'materials',
            jsonType: typeJson.deviceStatus,
            required:true,
            type: 'dropDown'
          },
       
          {
            label: "检查记录",
            prop: "checkRec",
            required:true,
            type:"textarea",
          },

          {
            label: '是否存在隐患',
            prop: 'isRisk',
            jsonType: typeJson.isRisk,
            required:true,
            type: 'dropDown'
          },
        
          {
            label: "来源",
            prop: "source", 
            jsonType:typeJson.source,
            type: "dropDown",
            
          },
          {
            label: "隐患部位",
            prop: "part",
            
          },
          {
            label: "隐患级别",
            prop: "level",
            type: "dropDown",
            jsonType: typeJson.level,
            
          },
          {
            label: "核查人",
            prop: "verifyManId",
            type: 'dropDownSearch',
            hidden: 'look',
            
            net: {
              url: '/app/memberinfo/getList',
              method: 'post',
              key: 'nickName',
              data:{
                mineId: true,
              },
              value: 'memberId'
            }
          },
          {
            label: "发现时间",
            prop: "discoverDate",
            
            type:"date"
          },
          // {
          //   label: '照片',
          //   prop: 'photo',
           
          //   type: 'image'
          // },
       
        ],
    
        
        net: {
       
            select: {
              url: `/app/checkRecDrain/getList`,
              method: 'post',
              data: {
                mineId: true,
                planType:2
              }
            },
            delete: {
              url: '/app/checkRecVentilate/delete',
              method: 'get',
              data: {
                
              }
            },
            insert: {
              url: '/app/checkRecDrain/insert',
              method: 'post',
              data: {
                mineId:true,
                recType:2,
                discoverManId:"userid",  
              }
            },
            update: {
              url: '/app/checkRecDrain/update',
              method: 'post',
              data: {
  
              }
            }
  
          
        },
        showCom:true
      },

     
  

  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    console.log('5555');
    this.setData({
      showCom: false
    });
    this.setData({
      showCom: true
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.setData({
      pullup: this.data.pullup + 1
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})